package com.ykq.service.impl;

import com.ykq.entity.Branch;
import com.ykq.entity.Staff;
import com.ykq.mapper.BranchMapper;
import com.ykq.service.BranchSerivce;
import com.ykq.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @Author: 闫克起
 * @Description:
 * @Date: Create in 11:54 2024/10/22
 */
@Service
public class BranchServiceImpl implements BranchSerivce {
    @Autowired
    private BranchMapper branchMapper;
    @Autowired
    private HttpSession session;
    @Override
    public R list() {
        Staff staff = (Staff) session.getAttribute("staff");
        List<Branch> branchList;
        if(staff.getBranchid().equals(12138)){
           branchList=branchMapper.selectAll();
        }else{
            branchList=branchMapper.selectByBranchId(staff.getBranchid());
        }
        return R.ok(branchList);
    }
}










